package so.shanku.essential.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import aym.util.json.JsonMap;
import com.nostra13.universalimageloader.core.ImageLoader;
import so.shanku.essential.R;
import so.shanku.essential.utils.StringUtil;

import java.util.List;
import java.util.Map;

/**
 * Created by Jaelyn on 2015/12/16 0016.
 * 退货 上传的附件
 */
public class AttachPicAdapter extends MyBaseAdapter {


	public AttachPicAdapter(Context context) {
		super(context);
	}

	public AttachPicAdapter(Context context, List<? extends Map<String, ?>> datas) {
		super(context, datas);
	}

	@Override
	public View getView(int i, View view, ViewGroup viewGroup) {
		AttachPicViewHolder attachPicViewHolder=null;
		if(view==null){
			view=layoutInflater.inflate(R.layout.attach_pic,null);
			attachPicViewHolder=new AttachPicViewHolder();
			attachPicViewHolder.attachPicIv= (ImageView) view.findViewById(R.id.attach_pic_iv);
			view.setTag(attachPicViewHolder);
		} else {
		  attachPicViewHolder= (AttachPicViewHolder) view.getTag();
		}
		JsonMap jsonMap= (JsonMap) datas.get(i);
		ImageLoader.getInstance().displayImage(StringUtil.get_SImage(jsonMap.getStringNoNull("ImgPath")),attachPicViewHolder.attachPicIv);
		return view;
	}

	class AttachPicViewHolder{
		ImageView attachPicIv;
	}
}
